import { request } from '@/apis';
import { addPrefix } from '@/utils/helper';

const prefixUrl = '/ep-query';

const Api = {
  /** 排污许可证 */
  permit: '/permit',
  permitManagementCategoryType: '/screen/permitManagementCategoryType',
  permitStatus: '/screen/permitStatus',
  permitPollution: '/screen/permitPollution',
  permitBeforeApply: '/permitBeforeApply',
  permitRegistration: '/permitRegistration',
  registrationChangeType: '/screen/permitRegistrationChangeType',
  permitRevocation: '/permitRevocation',
  permitCancellation: '/permitCancellation',
  permitLoss: '/permitLoss',
  permitRectification: '/permitRectification',
  permitImplementationReport: '/permitImplementationReport',
  reportType: '/screen/reportType'
};

addPrefix(Api, prefixUrl);

export interface IBaseParams {
  provinceCode?: string;
  cityCode?: string;
  countryCode?: string;
  industryCategoryCodeLv1?: string;
  industryCategoryCodeLv2?: string;
  industryCategoryCodeLv3?: string;
  pageNum?: number;
  pageSize?: number;
  searchTxt?: string;
  sortRule?: string;
  tagTypeCode?: string;
}

export interface IBeforeApply extends IBaseParams {
  heavyMetalPollutionLimitArea?: string;
  keyAtmosphericControlArea?: string;
  locatedInIndustrialPark?: string;
  productionEndDate?: string;
  productionStartDate?: string;
  tagTypeCode?: string;
  totalNitrogenControlArea?: string;
  totalPhosphorusControlArea?: string;
}

/** 排污许可证 */
export const getPermit = (params) => request.get({ url: Api.permit, params });

/** 排污申请前公示 */
export const getPermitBeforeApply = (params: IBeforeApply) => request.get({ url: Api.permitBeforeApply, params });

/** 排污登记信息 */
export const getPermitRegistration = (params) => request.get({ url: Api.permitRegistration, params });

/** 排污撤销 */
export const getPermitRevocation = (params) => request.get({ url: Api.permitRevocation, params });

/** 排污注销 */
export const getPermitCancellation = (params) => request.get({ url: Api.permitCancellation, params });

/** 排污遗失 */
export const getPermitLoss = (params) => request.get({ url: Api.permitLoss, params });

/** 登记类型 */
export const getRegistrationChangeType = () => request.get({ url: Api.registrationChangeType });
/** 许可证管理类别 */
export const getPermitManagementCategoryType = () => request.get({ url: Api.permitManagementCategoryType });
/** 许可证状态 */
export const getPermitStatus = () => request.get({ url: Api.permitStatus });
/** 污染物类别 */
export const getPermitPollutions = () => request.get({ url: Api.permitPollution });

/** 限期整改 */
export const getPermitRectification = (params) => request.get({ url: Api.permitRectification, params });

/** 执行报告 */
export const getPermitImplementationReport = (params) => request.get({ url: Api.permitImplementationReport, params });
/** 报告类型 */
export const getReportType = (params) => request.get({ url: Api.reportType, params });
